{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    {include file="form" /}
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
            {tp:menu menu="add,forbid,resume,delete,recyclebin" /}
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count ?? '0'}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
            <th width="70">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            {include file="td" /}
            <td class="f-14">
                <a href="javascript:;" onclick="agree('{$vo.id}')" class="label label-success radius" title="同意">同意</a>
                <a href="javascript:;" onclick="disagree('{$vo.id}')" class="label label-warning radius" title="不同意">不同意</a>
                {$vo.status|show_status=$vo.id}
                {tp:menu menu='sedit' /}
                {tp:menu menu='sdelete' /}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
  function agree(id){
      $.ajax({
          type: 'POST',
          url: "/admin/leave/agree?id="+id,
          data: null,
          success: function (re) {
              layer.msg(re.msg, {
                  time: 2000, //2s后自动关闭
              });
          },
      });
  }
  function disagree(id){
      //alert(data);
      var xmlhttp;
      if (window.XMLHttpRequest)
      {
          xmlhttp=new XMLHttpRequest();
      }
      else
      {
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange=function()
      {
          if (xmlhttp.readyState==4 && xmlhttp.status==200)
          {
              layer.msg("修改成功");
              location.reload();
          }
      }
      xmlhttp.open("GET","/admin/leave/disagree?id="+id,true);
      xmlhttp.send();
  }
  $("[name='leave_status']").find("[value='{$Request.param.leave_status}']").attr("selected", true);
</script>
{/block}
